package se.webbzon.boltzmann.effect;

import se.webbzon.boltzmann.game.character.AbstractCharacter;
import se.webbzon.boltzmann.game.character.CharacterActionEnum;
import se.webbzon.oschi01.worldarea.WorldArea;

public class CharacterDamageEffect extends CharacterEffect {
	
	// The current action of the character to damage
	private CharacterActionEnum characterAction;
	
	/*============================================================
	Constructors
	============================================================*/
	
	/** Creates a new effect where the given character is damaged for a given
	 * amount of steps. **/
	public CharacterDamageEffect(AbstractCharacter character, int duration) {
		super(character,duration);
	}
	
	/*============================================================
	Public Methods
	============================================================*/

	@Override public void onEffectBegin(WorldArea world) {
		final AbstractCharacter character = getCharacter();
		characterAction = character.getAction();
		character.setAction(CharacterActionEnum.DAMAGE);
	}
	
	@Override public void onEffectStep(WorldArea world) {};
	
	@Override public void onEffectEnd(WorldArea world) {
		getCharacter().setAction(characterAction);
	}
	
}
